<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<title>Using Inpolicy</title>
<link href="../docs-assets/Breadcrumbs.css" rel="stylesheet" rev="stylesheet" type="text/css">
		<meta name="viewport" content="width=device-width initial-scale=1">
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
		<meta http-equiv="Content-Language" content="en-gb">

<link href="../docs-assets/Contents.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Progress.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Navigation.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Fonts.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Base.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Colours.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/ConsoleText-Colours.css" rel="stylesheet" rev="stylesheet" type="text/css">
		
	</head>
	<body class="commentary-font">
		<nav role="navigation">
		<h1><a href="../index.html"><img src="../docs-assets/Inform.png" height=72> </a></h1>
<ul><li><a href="../index.html">home</a></li>
</ul><h2>Compiler</h2><ul>
<li><a href="../structure.html">structure</a></li>
<li><a href="../inbuildn.html">inbuild</a></li>
<li><a href="../inform7n.html">inform7</a></li>
<li><a href="../intern.html">inter</a></li>
<li><a href="../services.html">services</a></li>
<li><a href="../secrets.html">secrets</a></li>
</ul><h2>Other Tools</h2><ul>
<li><a href="../inblorbn.html">inblorb</a></li>
<li><a href="../inform6.html">inform6</a></li>
<li><a href="../inpolicyn.html">inpolicy</a></li>
</ul><h2>Resources</h2><ul>
<li><a href="../extensions.html">extensions</a></li>
<li><a href="../kits.html">kits</a></li>
</ul><h2>Repository</h2><ul>
<li><a href="https://github.com/ganelson/inform"><img src="../docs-assets/github.png" height=0> github</a></li>
</ul><h2>Related Projects</h2><ul>
<li><a href="https://github.com/ganelson/inweb"><img src="../docs-assets/github.png" height=0> inweb</a></li>
<li><a href="https://github.com/ganelson/intest"><img src="../docs-assets/github.png" height=0> intest</a></li>
</ul>
		</nav>
		<main role="main">
		<!-- Weave of 'Using Inpolicy' generated by inweb -->
<div class="breadcrumbs">
    <ul class="crumbs"><li><a href="../index.html">Home</a></li><li><a href="index.html">inpolicy</a></li><li><a href="index.html#M">Manual</a></li><li><b>Using Inpolicy</b></li></ul></div>
<p class="purpose">A very short guide to a very small program.</p>

<ul class="toc"><li><a href="M-ui.html#SP1">&#167;1. What Inpolicy is</a></li><li><a href="M-ui.html#SP3">&#167;3. Policies</a></li></ul><hr class="tocbar">

<p class="commentary firstcommentary"><a id="SP1" class="paragraph-anchor"></a><b>&#167;1. What Inpolicy is.</b>Inpolicy is a command-line tool whose sole purpose is to help keep the
Inform 7 source code tidy. Unlike Inweb, Intest and Indoc, this tool
can't sensibly be used for any project other than Inform.
</p>

<p class="commentary">If you have compiled the standard distribution of the command-line tools
for Inform then the Inpolicy executable will be at <span class="extract"><span class="extract-syntax">inpolicy/Tangled/inpolicy</span></span>.
Usage is very simple:
</p>

<pre class="ConsoleText-displayed-code all-displayed-code code-font">
<span class="ConsoleText-plain-syntax">    </span><span class="ConsoleText-element-syntax">$</span><span class="ConsoleText-plain-syntax"> </span><span class="ConsoleText-function-syntax">inpolicy/Tangled/inpolicy</span><span class="ConsoleText-plain-syntax"> POLICY</span>
</pre>
<p class="commentary">where <span class="extract"><span class="ConsoleText-extract-syntax">POLICY</span></span> is whatever we want to check. There are very few at present;
in some ways this program is a placeholder for future tightening-up of the
style rules.
</p>

<p class="commentary firstcommentary"><a id="SP2" class="paragraph-anchor"></a><b>&#167;2. </b>When it runs, Inpolicy needs to know where it is installed in the file
system. There is no completely foolproof, cross-platform way to know this
(on some Unixes, a program cannot determine its own location), so Inpolicy
decides by the following set of rules:
</p>

<ul class="items"><li>(a) If the user, at the command line, specified <span class="extract"><span class="ConsoleText-extract-syntax">-at P</span></span>, for some path
<span class="extract"><span class="ConsoleText-extract-syntax">P</span></span>, then we use that.
</li><li>(b) Otherwise, if the host operating system can indeed tell us where the
executable is, we use that. This is currently implemented only on MacOS,
Windows and Linux.
</li><li>(c) Otherwise, if the environment variable <span class="extract"><span class="ConsoleText-extract-syntax">$INPOLICY_PATH</span></span> exists and is
non-empty, we use that.
</li><li>(d) And if all else fails, we assume that the location is <span class="extract"><span class="ConsoleText-extract-syntax">inpolicy</span></span>, with
respect to the current working directory.
</li></ul>
<p class="commentary">If you're not sure what Inpolicy has decided and suspect it may be wrong,
running Inpolicy with the <span class="extract"><span class="ConsoleText-extract-syntax">-verbose</span></span> switch will cause it to print its belief
about its location as it starts up.
</p>

<p class="commentary firstcommentary"><a id="SP3" class="paragraph-anchor"></a><b>&#167;3. Policies.</b><span class="extract"><span class="ConsoleText-extract-syntax">-check-problems</span></span> makes a survey of (a) all of the Problem messages issued
within the Inform 7 compiler, (b) all of the Problem test cases, and (c) all
of the advisory references to Problems in the Inform documentation, and
attempts to match these up. It prints out a report, and concludes with either
"All is well" or a recommendation for changes. For example:
</p>

<pre class="ConsoleText-displayed-code all-displayed-code code-font">
<span class="ConsoleText-plain-syntax">    1009 problem name(s) have been observed:</span>
<span class="ConsoleText-plain-syntax">        Problems actually existing (the source code refers to them):</span>
<span class="ConsoleText-plain-syntax">            906 problem(s) are named and in principle testable</span>
<span class="ConsoleText-plain-syntax">            81 problem(s) are 'BelievedImpossible', that is, no known source text causes them</span>
<span class="ConsoleText-plain-syntax">            14 problem(s) are 'Untestable', that is, not mechanically testable</span>
<span class="ConsoleText-plain-syntax">            8 problem(s) are '...', that is, they need to be give a name and a test case</span>
<span class="ConsoleText-plain-syntax">        Problems which should have test cases:</span>
<span class="ConsoleText-plain-syntax">            904 problem(s) have test cases</span>
<span class="ConsoleText-plain-syntax">            2 problem(s) have no test case yet:</span>
<span class="ConsoleText-plain-syntax">                PM_SuperfluousOf</span>
<span class="ConsoleText-plain-syntax">                PM_MisplacedFrom</span>
<span class="ConsoleText-plain-syntax">        Problems which are cross-referenced in 'Writing with Inform':</span>
<span class="ConsoleText-plain-syntax">            483 problem(s) are cross-referenced</span>
<span class="ConsoleText-plain-syntax">    All is well.</span>
</pre>
<p class="commentary">As this example report shows, small sins are forgiven.
</p>

<p class="commentary firstcommentary"><a id="SP4" class="paragraph-anchor"></a><b>&#167;4. </b><span class="extract"><span class="ConsoleText-extract-syntax">-kit-versions</span></span> reports the version numbers of the five kits built in to an
Inform installation. The policy here is that these should always have version
numbers exactly matching that of the core <span class="extract"><span class="ConsoleText-extract-syntax">inform7</span></span> version number; so the
option <span class="extract"><span class="ConsoleText-extract-syntax">-sync-kit-versions</span></span> is provided to enforce this, by changing the
version numbers of the kits accordingly.
</p>

<nav role="progress"><div class="progresscontainer">
    <ul class="progressbar"><li class="progressprevoff">&#10094;</li><li class="progresscurrentchapter">M</li><li class="progresscurrent">ui</li><li class="progresssection"><a href="M-rc.html">rc</a></li><li class="progresschapter"><a href="1-bsc.html">1</a></li><li class="progresschapter"><a href="2-pc.html">2</a></li><li class="progressnext"><a href="M-rc.html">&#10095;</a></li></ul></div>
</nav><!-- End of weave -->

		</main>
	</body>
</html>

